Passed
Pull Request — master (#10)
by Mark
03:07
created

script.js ➔ olInit   B

Complexity

Conditions 8

Size

Total Lines 58
Code Lines 36

Duplication

Lines 31
Ratio 53.45 %

Importance

Changes 0
Metric Value
eloc 36
c 0
b 0
f 0
dl 31
loc 58
rs 7.1493
cc 8

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/*
2
 * Copyright (c) 2022 Mark C. Prins <[email protected]>
3
 *
4
 * Permission to use, copy, modify, and distribute this software for any
5
 * purpose with or without fee is hereby granted, provided that the above
6
 * copyright notice and this permission notice appear in all copies.
7
 *
8
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
 */
16
17
18
19
/**
20
 * Test for css support in the browser by sniffing for a css class we added
21
 * using javascript added by the action plugin; this is an edge case because
22
 * browsers that support javascript generally support css as well.
23
 *
24
 * @returns {Boolean} true when the browser supports css (and implicitly
25
 *          javascript)
26
 */
27
function olTestCSSsupport() {
28
    return (jQuery('.olCSSsupported').length > 0);
29
}
30
31
/**
32
 * Creates a DocumentFragment to insert into the dom.
33
 *
34
 * @param mapid
35
 *            id for the map div
36
 * @param width
37
 *            width for the map div
38
 * @param height
39
 *            height for the map div
40
 * @returns a {DocumentFragment} element that can be injected into the dom
41
 */
42
function olCreateMaptag(mapid, width, height) {
43
    const mEl = '<div id="' + mapid + '-olContainer" class="olContainer olWebOnly">'
44
            // map
45
            + '<div id="' + mapid + '" tabindex="0" style="width:' + width + ';height:' + height + ';" class="olMap"></div>'
46
            + '</div>',
47
        // fragment
48
        frag = document.createDocumentFragment(),
49
        // temp node
50
        temp = document.createElement('div');
51
    temp.innerHTML = mEl;
52
    while (temp.firstChild) {
53
        frag.appendChild(temp.firstChild);
54
    }
55
    return frag;
56
}
57
58
/**
59
 * Create the map based on the params given.
60
 *
61
 * @param {Object}
62
 *            mapOpts MapOptions hash {id:'olmap', width:500px, height:500px,
63
 *            lat:6710200, lon:506500, zoom:13, statusbar:1, controls:1,
64
 *            poihoverstyle:1, baselyr:'', kmlfile:'', gpxfile:'', geojsonfile,
65
 *            summary:''}
66
 * @param {Array}
67
 *            OLmapPOI array with POI's [ {lat:6710300,lon:506000,txt:'instap
68
 *            punt',angle:180,opacity:.9,img:'', rowId:n},... ]);
69
 *
70
 * @return {OpenLayers.Map} the created map
71
 */
72
function createMap(mapOpts, poi) {
73
74
    // const mapOpts = olMapData[0].mapOpts;
75
    // const poi = olMapData[0].poi;
76
77
    if (!olEnable) {
0 ignored issues
show
Best Practice introduced by
If you intend to check if the variable olEnable is declared in the current environment, consider using typeof olEnable === "undefined" instead. This is safe if the variable is not actually declared.
Loading history...
78
        return;
0 ignored issues
show
Comprehensibility Best Practice introduced by
Are you sure this return statement is not missing an argument? If this is intended, consider adding an explicit undefined like return undefined;.
Loading history...
79
    }
80
    if (!olTestCSSsupport()) {
81
        olEnable = false;
0 ignored issues
show
Bug introduced by
The local (let) variable olEnable is used before it is defined. This will cause a reference error.
Loading history...
82
        return;
0 ignored issues
show
Comprehensibility Best Practice introduced by
Are you sure this return statement is not missing an argument? If this is intended, consider adding an explicit undefined like return undefined;.
Loading history...
83
    }
84
85
    // find map element location
86
    var cleartag = document.getElementById(mapOpts.id + '-clearer');
87
    if (cleartag === null) {
88
        return;
0 ignored issues
show
Comprehensibility Best Practice introduced by
Are you sure this return statement is not missing an argument? If this is intended, consider adding an explicit undefined like return undefined;.
Loading history...
89
    }
90
    // create map element and add to document
91
    var fragment = olCreateMaptag(mapOpts.id, mapOpts.width, mapOpts.height);
92
    cleartag.parentNode.insertBefore(fragment, cleartag);
93
94
95
96
const overlayGroup = new ol.layer.Group({title: 'Overlays', fold: 'open', layers: []});
0 ignored issues
show
Bug introduced by
The variable ol seems to be never declared. If this is a global, consider adding a /** global: ol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
97
const baseLyrGroup = new ol.layer.Group({'title': 'Base maps', layers: []});
98
99
const map = new ol.Map({
100
    target: document.getElementById('map'),
101
    layers: [baseLyrGroup, overlayGroup],
102
    view:   new ol.View({
103
        center:     ol.proj.transform([mapOpts.lon, mapOpts.lat], 'EPSG:4326', 'EPSG:3857'),
104
        zoom:       mapOpts.zoom,
105
        projection: 'EPSG:3857'
106
    })
107
});
108
109
let /**
110
 * Thunderforest API key.
111
 *
112
 * @type {String}
113
 */
114
tfApiKey = '';
115
let /**
116
 * OSM tiles flag.
117
 *
118
 * @type {Boolean}
119
 */
120
osmEnable = true;
121 View Code Duplication
if (osmEnable) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
122
    baseLyrGroup.getLayers().push(
123
        new ol.layer.Tile({
124
            visible: true,
125
            title:   'OSM',
126
            type:    'base',
127
            source:  new ol.source.OSM()
128
        }));
129
130
    baseLyrGroup.getLayers().push(
131
        new ol.layer.Tile({
132
            visible: mapOpts.baselyr === "cycle map",
133
            title:   'cycle map',
134
            type:    'base',
135
            source:  new ol.source.OSM({
136
                url:          'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=' + tfApiKey,
137
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
138
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
139
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
140
            })
141
        }));
142
143
    baseLyrGroup.getLayers().push(
144
        new ol.layer.Tile({
145
            visible: mapOpts.baselyr === "transport",
146
            title:   'transport',
147
            type:    'base',
148
            source:  new ol.source.OSM({
149
                url:          'https://{a-c}.tile.thunderforest.com/transport/{z}/{x}/{y}.png?apikey=' + tfApiKey,
150
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
151
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
152
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
153
            })
154
        }));
155
156
    baseLyrGroup.getLayers().push(
157
        new ol.layer.Tile({
158
            visible: mapOpts.baselyr === "landscape",
159
            title:   'landscape',
160
            type:    'base',
161
            source:  new ol.source.OSM({
162
                url:          'https://{a-c}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png?apikey=' + tfApiKey,
163
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
164
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
165
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
166
            })
167
        }));
168
169
    baseLyrGroup.getLayers().push(
170
        new ol.layer.Tile({
171
            visible: mapOpts.baselyr === "outdoors",
172
            title:   'outdoors',
173
            type:    'base',
174
            source:  new ol.source.OSM({
175
                url:          'https://{a-c}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png?apikey=' + tfApiKey,
176
                attributions: 'Data &copy;ODbL <a href="https://openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>, '
177
                                  + 'Tiles &copy;<a href="https://www.thunderforest.com/" target="_blank">Thunderforest</a>'
178
                                  + '<img src="https://www.thunderforest.com/favicon.ico" alt="Thunderforest logo"/>'
179
            })
180
        }));
181
}
182
183
let /**
184
 * Bing tiles flag.
185
 *
186
 * @type {Boolean}
187
 */
188
bEnable = false;
189
let /**
190
 * Bing API key.
191
 *
192
 * @type {String}
193
 */
194
bApiKey = '';
195 View Code Duplication
if (bEnable && bApiKey !== '') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
196
    baseLyrGroup.getLayers().push(
197
        new ol.layer.Tile({
198
            visible: mapOpts.baselyr === "bing road",
199
            title:   'bing road',
200
            type:    'base',
201
            source:  new ol.source.BingMaps({
202
                key:        bApiKey,
203
                imagerySet: 'Road'
204
            })
205
        }));
206
207
    baseLyrGroup.getLayers().push(
208
        new ol.layer.Tile({
209
            visible: mapOpts.baselyr === "bing sat",
210
            title:   'bing sat',
211
            type:    'base',
212
            source:  new ol.source.BingMaps({
213
                key:        bApiKey,
214
                imagerySet: 'Aerial'
215
            })
216
        }));
217
218
    baseLyrGroup.getLayers().push(
219
        new ol.layer.Tile({
220
            visible: mapOpts.baselyr === "bing hybrid",
221
            title:   'bing hybrid',
222
            type:    'base',
223
            source:  new ol.source.BingMaps({
224
                key:        bApiKey,
225
                imagerySet: 'AerialWithLabels'
226
            })
227
        }));
228
}
229
230
let /**
231
 * Stamen tiles flag.
232
 *
233
 * @type {Boolean}
234
 */
235
stamenEnable = false;
236
if (stamenEnable) {
237
    baseLyrGroup.getLayers().push(
238
        new ol.layer.Tile({
239
            visible: false,
240
            type:    'base',
241
            title:   'toner',
242
            source:  new ol.source.Stamen({layer: 'toner'})
243
        })
244
    );
245
    baseLyrGroup.getLayers().push(
246
        new ol.layer.Tile({
247
            visible: false,
248
            type:    'base',
249
            title:   'terrain',
250
            source:  new ol.source.Stamen({layer: 'terrain'})
251
        })
252
    );
253
}
254
255
map.addControl(new ol.control.ScaleLine({bar: true, text: true}));
256
map.addControl(new ol.control.MousePosition({
257
    coordinateFormat: ol.coordinate.createStringXY(4), projection: 'EPSG:4326',
258
}));
259
map.addControl(new ol.control.FullScreen());
260
map.addControl(new ol.control.OverviewMap());
261
map.addControl(new ol.control.LayerSwitcher());
262
263
const iconScale = 1.5;
264
const vectorSource = new ol.source.Vector();
265 View Code Duplication
poi.forEach((p) => {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
266
    const f = new ol.Feature({
0 ignored issues
show
Bug introduced by
The variable ol seems to be never declared. If this is a global, consider adding a /** global: ol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
267
        geometry:    new ol.geom.Point(ol.proj.fromLonLat([p.lon, p.lat])),
268
        description: p.txt,
269
        img:         p.img,
270
        rowId:       p.rowId,
271
        lat:         p.lat,
272
        lon:         p.lon,
273
        angle:       p.angle,
274
        alt:         p.img.substring(0, p.img.lastIndexOf("."))
275
    });
276
    f.setId(p.rowId);
277
    f.setStyle(new ol.style.Style({
278
        text:      new ol.style.Text({
279
            text:           "" + p.rowId,
280
            textAlign:      'left',
281
            textBaseline:   'bottom',
282
            offsetX:        8,
283
            offsetY:        -8,
284
            scale:          iconScale,
285
            fill:           new ol.style.Fill({color: 'rgb(0,0,0)'}),
286
            font:           '12px monospace bold',
287
            backgroundFill: new ol.style.Fill({color: 'rgba(255,255,255,.4)'})
288
        }), image: new ol.style.Icon({
289
            src: "./" + p.img, crossOrigin: '', opacity: p.opacity, scale: iconScale, rotation: p.angle * Math.PI / 180,
290
        }),
291
    }));
292
    vectorSource.addFeature(f);
293
});
294
295
overlayGroup.getLayers().push(new ol.layer.Vector({title: 'POI', visible: true, source: vectorSource}));
296
297
if (mapOpts.kmlfile.length > 0) {
298
    overlayGroup.getLayers().push(new ol.layer.Vector({
299
        title:  'KML file', visible: true,
300
        source: new ol.source.VectorSource({
301
            url:    mapOpts.kmlfile,
302
            format: new ol.format.KML(),
303
        }),
304
        style:  {label: "${name}"}
305
    }));
306
}
307
308
if (mapOpts.geojsonfile.length > 0) {
309
    overlayGroup.getLayers().push(new ol.layer.Vector({
310
        title:  'GeoJSON file', visible: true,
311
        source: new ol.source.VectorSource({
312
            url:    mapOpts.geojsonfile,
313
            format: new ol.format.GeoJSON(),
314
        }),
315
        style:  {
316
            /* TODO */
317
            strokeColor:   "#FF00FF",
318
            strokeWidth:   3,
319
            strokeOpacity: 0.7,
320
            pointRadius:   4,
321
            fillColor:     "#FF99FF",
322
            fillOpacity:   0.7
323
        }
324
    }));
325
}
326
327
if (mapOpts.gpxfile.length > 0) {
328
    overlayGroup.getLayers().push(new ol.layer.Vector({
329
        title:  'GPS track', visible: true,
330
        source: new ol.source.VectorSource({
331
            url:    mapOpts.gpxfile,
332
            format: new ol.format.GPX(),
333
        }),
334
        style:  {
335
            /* TODO */
336
            strokeColor:   "#0000FF",
337
            strokeWidth:   3,
338
            strokeOpacity: 0.7,
339
            pointRadius:   4,
340
            fillColor:     "#0099FF",
341
            fillOpacity:   0.7
342
        }
343
    }));
344
}
345
346
const container = document.getElementById('popup');
347
const content = document.getElementById('popup-content');
348
const closer = document.getElementById('popup-closer');
349
350
const overlay = new ol.Overlay({
351
    element: container, autoPan: true, autoPanAnimation: {
352
        duration: 250,
353
    }, //stopEvent: false,
354
});
355
map.addOverlay(overlay);
356
357
/**
358
 * Add a click handler to hide the popup.
359
 * @return {boolean} Don't follow the href.
360
 */
361
closer.onclick = function () {
362
    overlay.setPosition(undefined);
363
    closer.blur();
364
    return false;
365
};
366
367
// display popup on click
368 View Code Duplication
map.on('singleclick', function (evt) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
369
    const selFeature = map.forEachFeatureAtPixel(evt.pixel, function (feature) {
370
        return feature;
371
    });
372
    if (selFeature) {
373
        overlay.setPosition(evt.coordinate);
374
375
        let pContent = '<div class="spacer">&nbsp;</div>';
376
        let locDesc = '';
377
378
        if (selFeature.get('rowId') !== undefined) {
379
            pContent += '<span class="rowId">' + selFeature.get('rowId') + ': </span>';
380
        }
381
        if (selFeature.get('name') !== undefined) {
382
            pContent += '<span class="txt">' + selFeature.get('name') + '</span>';
383
            locDesc = selFeature.get('name');
0 ignored issues
show
Unused Code introduced by
The variable locDesc seems to be never used. Consider removing it.
Loading history...
384
            // TODO strip <p> tag from locDesc
385
            // locDesc = selFeature.get('name').split(/\s+/).slice(0,2).join('+');
386
        }
387
        if (selFeature.get('ele') !== undefined) {
388
            pContent += '<div class="ele">elevation: ' + selFeature.get('ele') + '</div>';
389
        }
390
        if (selFeature.get('type') !== undefined) {
391
            pContent += '<div>' + selFeature.get('type') + '</div>';
392
        }
393
        if (selFeature.get('time') !== undefined) {
394
            pContent += '<div class="time">time: ' + selFeature.get('time') + '</div>';
395
        }
396
        if (selFeature.get('description') !== undefined) {
397
            pContent += '<div class="desc">' + selFeature.get('description') + '</div>';
398
        }
399
        if (selFeature.get('img') !== undefined) {
400
            pContent += '<div class="coord" title="lat;lon">' + '<img src="' + selFeature.get('img') + '" width="16" height="16" ' + 'style="transform:rotate(' + selFeature.get('angle') + 'deg)" />&nbsp;' + '<a href="geo:' + selFeature.get('lat') + ',' + selFeature.get('lon') + '?q=' + selFeature.get('lat') + ',' + selFeature.get('lon') + '(' + selFeature.get('alt') + ')" title="Open in navigation app">' + ol.coordinate.format([selFeature.get('lon'), selFeature.get('lat')], '{x}º; {y}º', 4) + '</a></div>';
0 ignored issues
show
Bug introduced by
The variable ol seems to be never declared. If this is a global, consider adding a /** global: ol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
401
        }
402
        content.innerHTML = pContent;
403
    } else {
0 ignored issues
show
Comprehensibility Documentation Best Practice introduced by
This code block is empty. Consider removing it or adding a comment to explain.
Loading history...
404
        // do nothing?...
405
    }
406
});
407
408
// change mouse cursor when over marker
409
map.on('pointermove', function (e) {
410
    const pixel = map.getEventPixel(e.originalEvent);
411
    const hit = map.hasFeatureAtPixel(pixel);
412
    map.getTarget().style.cursor = hit ? 'pointer' : '';
413
});
414
415
    return map;
416
}
417
418
419
/** init. */
420
function olInit() {
421
    if (olEnable) {
0 ignored issues
show
Best Practice introduced by
If you intend to check if the variable olEnable is declared in the current environment, consider using typeof olEnable === "undefined" instead. This is safe if the variable is not actually declared.
Loading history...
422
423
424
425
426
        var _i = 0;
427
        // create the maps in the page
428 View Code Duplication
        for (_i = 0; _i < olMapData.length; _i++) {
0 ignored issues
show
Bug introduced by
The local (let) variable olMapData is used before it is defined. This will cause a reference error.
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
429
            var _id = olMapData[_i].mapOpts.id;
430
            olMaps[_id] = createMap(olMapData[_i].mapOpts, olMapData[_i].poi);
0 ignored issues
show
Bug introduced by
The local (let) variable olMaps is used before it is defined. This will cause a reference error.
Loading history...
431
432
            // set max-width on help pop-over
433
            jQuery('#' + _id).parent().parent().find('.olMapHelp').css('max-width', olMapData[_i].mapOpts.width);
434
435
            // shrink the map width to fit inside page container
436
            const _w = jQuery('#' + _id + '-olContainer').parent().innerWidth();
437
            if (parseInt(olMapData[_i].mapOpts.width) > _w) {
438
                jQuery('#' + _id).width(_w);
439
                jQuery('#' + _id + '-olStatusBar').width(_w);
440
                jQuery('#' + _id).parent().parent().find('.olMapHelp').width(_w);
441
                olMaps[_id].updateSize();
442
            }
443
        }
444
445
        var resizeTimer;
446 View Code Duplication
        jQuery(window).on('resize', function (e) {
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
447
            clearTimeout(resizeTimer);
448
            resizeTimer = setTimeout(function () {
449
                for (_i = 0; _i < olMapData.length; _i++) {
0 ignored issues
show
Bug introduced by
The local (let) variable olMapData is used before it is defined. This will cause a reference error.
Loading history...
Bug introduced by
The variable _i is changed as part of the for loop for example by _i++ on line 449. Only the value of the last iteration will be visible in this function if it is called after the loop.
Loading history...
450
                    var _id = olMapData[_i].mapOpts.id;
451
                    var _w = jQuery('#' + _id + '-olContainer').parent().innerWidth();
452
                    if (parseInt(olMapData[_i].mapOpts.width) > _w) {
453
                        jQuery('#' + _id).width(_w);
454
                        jQuery('#' + _id + '-olStatusBar').width(_w);
455
                        jQuery('#' + _id).parent().parent().find('.olMapHelp').width(_w);
456
                        olMaps[_id].updateSize();
0 ignored issues
show
Bug introduced by
The local (let) variable olMaps is used before it is defined. This will cause a reference error.
Loading history...
457
                    }
458
                }
459
            }, 250);
460
        });
461
462
        // hide the table(s) with POI by giving it a print-only style
463
        jQuery('.olPOItableSpan').addClass('olPrintOnly');
464
        // hide the static map image(s) by giving it a print only style
465
        jQuery('.olStaticMap').addClass('olPrintOnly');
466
        // add help button with toggle.
467
        jQuery('.olWebOnly > .olMap')
468
            .prepend(
469
                '<div class="olMapHelpButtonDiv">'
470
                + '<button onclick="jQuery(\'.olMapHelp\').toggle(500);" class="olMapHelpButton olHasTooltip"><span>'
471
                + OpenLayers.i18n("toggle_help") + '</span>?</button></div>');
0 ignored issues
show
Bug introduced by
The variable OpenLayers seems to be never declared. If this is a global, consider adding a /** global: OpenLayers */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
472
        // toggle to switch dynamic vs. static map
473
        jQuery('.olMapHelp').before(
474
            '<div class="a11y"><button onclick="jQuery(\'.olPrintOnly\').toggle();jQuery(\'.olWebOnly\').toggle();">'
475
            + OpenLayers.i18n("toggle_dynamic_map") + '</button></div>');
476
    }
477
}
478
479
480
/**
481
 * ol api flag.
482
 *
483
 * @type {Boolean}
484
 */
485
let olEnable = false;
0 ignored issues
show
Unused Code introduced by
The variable olEnable seems to be never used. Consider removing it.
Loading history...
486
    /**
487
     * An array with data for each map in the page.
488
     *
489
     * @type {Array}
490
     */
491
        const   olMapData = [];
0 ignored issues
show
Unused Code introduced by
The constant olMapData seems to be never used. Consider removing it.
Loading history...
492
    /**
493
     * Holds a reference to all of the maps on this page with the map's id as key.
494
     * Can be used as an extension point.
495
     *
496
     * @type {Object}
497
     */
498
    let   olMaps = {};
0 ignored issues
show
Unused Code introduced by
The variable olMaps seems to be never used. Consider removing it.
Loading history...
499
    /**
500
     * Stamen tiles flag.
501
     *
502
     * @type {Boolean}
503
     */
504
    let  stamenEnable = false;
0 ignored issues
show
Unused Code introduced by
The variable stamenEnable seems to be never used. Consider removing it.
Loading history...
505
506
    /**
507
     * Bing tiles flag.
508
     *
509
     * @type {Boolean}
510
     */
511
    let   bEnable = false;
0 ignored issues
show
Unused Code introduced by
The variable bEnable seems to be never used. Consider removing it.
Loading history...
512
    /**
513
     * Bing API key.
514
     *
515
     * @type {String}
516
     */
517
    let  bApiKey = '';
0 ignored issues
show
Unused Code introduced by
The variable bApiKey seems to be never used. Consider removing it.
Loading history...
518
519
    /**
520
     * Thunderforest API key.
521
     *
522
     * @type {String}
523
     */
524
    let   tfApiKey = ''
0 ignored issues
show
Unused Code introduced by
The variable tfApiKey seems to be never used. Consider removing it.
Loading history...
525
    /**
526
     * OSM tiles flag.
527
     *
528
     * @type {Boolean}
529
     */
530
    let   osmEnable = true;
0 ignored issues
show
Unused Code introduced by
The variable osmEnable seems to be never used. Consider removing it.
Loading history...
531
    /**
532
     * CSS support flag.
533
     *
534
     * @type {Boolean}
535
     */
536
    let   olCSSEnable = true;
0 ignored issues
show
Unused Code introduced by
The variable olCSSEnable seems to be never used. Consider removing it.
Loading history...
537
538
/* register olInit to run with onload event. */
539
jQuery(olInit);
540